package tr.mesir.ws;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import tr.mesir.service.AddressBookService;

/**
 * This is the simple SOAP-based WS by CXF and JAX-WS. With the @WebService, AddressBookWebService
 * is exposed as a service. It's also a spring-bean, so it can have @AutoWired properties. The bean
 * is declared as an endpoint inside the applicationContext.xml. Beware that we don't have the 
 * conversation.access scope defined with this bean. That's because, Orchestra will not handle the 
 * conversations for a WS call.
 *  
 * @author mertcaliskan
 */
@Component("addressBookWebService")
@WebService
public class AddressBookWebService {

	@Autowired
	private AddressBookService addressBookService;
	
	/* This is method which is exposed as a Web Service operation by @WebMethod.
	 * By default, operationName is same as the name of the method.
	 */
	@WebMethod
	public List<String> allAddressBookTitles() {
		return addressBookService.findAllTitles();
	}
}